package cn.lx.demo;

/**
 * @author lixin
 * @Classname ConcreteCreator
 * @Description 产品类的创建
 * @Date 2019/10/4 上午10:31
 */
public class ConcreteCreator extends Creator {
    @Override
    public <T extends Product> T createProduct(Class<T> t) {
        Product product = null;
        try {
            product = (Product) Class.forName(t.getName()).newInstance();
        } catch (Exception e) {
            e.printStackTrace();
        }
        return (T) product;
    }
}
